|
|
|
|
|
|
|
Chapter 12
Two-Dimensional Transformations |
|
|
|
|
|
|
|
|
This chapter explains the basics of two-dimensional transformations. It begins by discussing object-oriented techniques you can use to manage the objects in your pictures. Besides drawing graphical objects, these techniques let you quickly load or save pictures to a file. |
|
|
|
|
|
|
|
|
Next, the chapter describes windowing, viewports, scrolling, panning, and zooming. Using the mapping between a world window and a viewport, you can display different parts of a picture at different levels of magnification and with different scales along the X and Y axes. |
|
|
|
|
|
|
|
|
The chapter then explains the matrix representations of translation, scaling, and rotation transformations. Once you can represent these operations using matrices, you can compose them to build complex transformations represented by a single matrix. |
|
|
|
|
|
|
|
|
The chapter finishes by describing quadtrees. A quadtree is a spatial data structure for locating and displaying items quickly in even the largest pictures. |
|
|
|
|
|
|
|
|
Modeling Two-Dimensional Objects |
|
|
|
|
|
|
|
|
Before you can draw an object on your computer's screen, you must have some way to describe that object in memory. You can use a Type statement to create a user-defined data type for storing object information. For example, you might use the following data type to store information about line segments. |
|
|
|
 |
|
|
|
|
Private Type MyLine
x1 As Single
y1 As Single
x2 As Single
y2 As Single
End Type |
|
|
|
|
|